#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from multiprocessing import Process
import socket


def so(conn, addr):
    data = conn.recv(1024)
    conn.send(data.upper())


if __name__ == '__main__':
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(("127.0.0.1", 2011))
    s.listen(1)
    conn_list = []
    while True:
        conn, addr = s.accept()
        # res = (i for i in conn_list if i.get(addr[0])).__next__()
        # conn_list.append({addr[0]: conn})
        # print(conn, addr)
        server = Process(target=so, args=(conn, addr,))
        server.start()
        server.join()
